const express = require('express')
const cors = require('cors')
const http = require('http')

const init = require('./func/init')
const port = require('./constants/index').PORT

const routerAuth = require('./routers/auth')
const routerAdmin = require('./routers/admin')
const routerUser = require('./routers/user')

const app = express()

init(app)

app.use(cors())
app.use(express.json())

app.use('/auth', routerAuth)
app.use('/admin', routerAdmin)
app.use('/user', routerUser)

http.createServer(app).listen(port, () => {
    console.log(`listen ${port}...`)
})
